/*
 * Copyright (c) 2015. 石头哥哥
 */

package com.comom.manager.model.vo;

import com.comom.manager.model.User;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;


/**
 * Created by 石头哥哥 on 15/7/16.
 * PROJECT_NAME: server-java-mengchong
 * PACKAGE_NAME: com.mengchong.server.model.vo
 * COMMENT : json  数据组装对象    ，针对非空字段进行序列化
 */
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class ResponseVo {


    /**
     * user 对象
     */
    private User user;



    /**
     * 清理系统资源
     */
    public void release() {

    }

    /**
     * @return
     */
    private static ResponseVo newBuilder() {
        return new ResponseVo();
    }


    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    /**
     * jackson test
     *
     * @param args
     * @throws JsonProcessingException
     */
    public static void main(String[] args) throws JsonProcessingException {
        ObjectMapper mapper = new ObjectMapper();
        ResponseVo responseVo = ResponseVo.newBuilder();
        responseVo.setUser(new User());
        System.out.println(mapper.writeValueAsString(responseVo));
    }
}
